package cn.broadsense.thrid.param;

import cn.broadsense.thrid.result.VideoExTractListResult;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 以图搜图 接口
 *
 * @author pengxin
 * @date 2022-12-01 10:45
 */
@ApiModel("以图搜图请求参数")
@NoArgsConstructor
@Data
public class VideoExTractListParam extends BasePageParam {
    private static final long serialVersionUID = 2735158197688438532L;
    /**
     * 图片
     */
    @ApiModelProperty("图片列表")
    @NotNull
    private List<ImagesParam> images;
    /**
     * 点位code
     * */
    @ApiModelProperty("点位列表 不传查所有点位")
    private List<String> channelCodes = new ArrayList<>();
    /**
     * 开始时间utc时间 20221201T155959Z
     */
    @ApiModelProperty("开始时间时间戳")
    private String startTime;
    /**
     * 结束时间 utc 时间
     */
    @ApiModelProperty("结束时间时间戳")
    private String endTime;
    /**
     * 相识度
     */
    @ApiModelProperty(" 相似度")
    private BigDecimal threshold;
    /**
     * 第二次查询传任务id
     */
    @ApiModelProperty("任务id第一次穿空 第二次必填")
    private String taskId;
    /**
     * 1-人；2-机动车；3-非机动车
     */
    @NotNull(message = "类型不能为空")
    @ApiModelProperty("类型 1-人；2-机动车；3-非机动车")
    private Integer objectType;
    /**
     * 排序
     */
    @ApiModelProperty(hidden = true)
    private String order = "desc";
    /**
     * 排序字段 默认相识度
     */
    @ApiModelProperty(hidden = true)
    private String orderBy = "threshold";
    /**
     * 0 实时任务 1录像任务 2本地任务
     */
    @ApiModelProperty(hidden = true,value = " 0 实时任务 1录像任务 2本地任务")
    private Integer retrievalType = 0;
    /**
     * 属性筛选默认1
     */
    @ApiModelProperty(hidden = true)
    private Integer attributeFilter = 1;
    /**
     * 属性筛选值
     */
    @ApiModelProperty(hidden = true)
    private SearchAttributeParam searchAttribute = new SearchAttributeParam();

    @ApiModelProperty("校验值记录搜图传")
    private String checkSign;


    @Override
    public void checkParam() {

    }

    @Override
    public Class getResultClass() {
        return VideoExTractListResult.class;
    }


    @NoArgsConstructor
    @Data
    public static class SearchAttributeParam {
        private String relatedFace;
        private String relatedPerson;
        private String relatedNonVehicle;
        private String relatedVehicle;
        private String relatedGait;
    }

    @NoArgsConstructor
    @Data
    public static class ImagesParam {
        private ImageParam image;
        /**
         * 随机生成
         */
        private Integer retrievalId;

        @NoArgsConstructor
        @Data
        public static class ImageParam {
            private String uri;
            @ApiModelProperty("图片base64")
            private String data;
            @ApiModelProperty("特征值")
            private String feature;
            /**
             * 图片坐标
             */
            private RectParam rect;
            private Integer extractNoDetect = 0;

            @NoArgsConstructor
            @Data
            public static class RectParam {
                private Integer leftTopX;
                private Integer leftTopY;
                private Integer rightBtmX;
                private Integer rightBtmY;
            }
        }
    }
}
